package com.lq.createPattern.prototype.deepclone;

import java.io.Serializable;

public class DeepProtoType implements Serializable,Cloneable {
    public String name;
    public DeepCloneableTarget deepCloneableTarget;
    public DeepProtoType(){
         super();
     }
     //深拷贝 方式一  使用clone方法

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Object deep=null;
        //这里完成基本数据类型和String的克隆
        deep=super.clone();
        DeepProtoType deepProtoType=(DeepProtoType) deep;
        deepProtoType.deepCloneableTarget=(DeepCloneableTarget) deepCloneableTarget.clone();

        return deepProtoType;
    }

}
